extends Node
class_name ArenaDifficulty

@export var vitory_screen: PackedScene
@export var increase_difficulty_rate = 20

@onready var timer = $Timer
signal arena_diffuculy_increased(difficult:int)

var areana_difficuly = 1

func _ready() -> void:
	timer.timeout.connect(on_timeout)
	
func _process(delta: float) -> void:
	var current_time = int(get_time_elapsed())
	if current_time >= 60 :
		pass
	elif current_time >= areana_difficuly * increase_difficulty_rate:
		areana_difficuly+=1
		arena_diffuculy_increased.emit(areana_difficuly)
	
func get_time_elapsed():
	return timer.wait_time - timer.time_left

# 胜利结算画面
func on_timeout():
	var victory_screen_ins = vitory_screen.instantiate()
	add_child(victory_screen_ins)
	
	
